package br.com.firula.to;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.annotations.Filter;
import org.hibernate.annotations.FilterJoinTable;

@MappedSuperclass
@Filter(name="naoRemovido", condition="removido = false")
@FilterJoinTable(name="naoRemovido" , condition="removido = false")
public abstract class BaseTO implements Serializable {
    private static final long serialVersionUID = 3256446889040622647L;
	
    public String toString() {
        return ToStringBuilder.reflectionToString(this,
                ToStringStyle.MULTI_LINE_STYLE);
    }
    
    //@Id
	//@Column(name="id", nullable=false)	
	//@GeneratedValue(strategy=GenerationType.AUTO) 
    //protected Long id;
    
	@Column(name="dataCriacao")
	protected Date dataCriacao;
	
	@Column(name="dataAlteracao")
	protected Date dataAlteracao;
	
	@Column(name="dataRemocao")
	protected Date dataRemocao;
	
	@Column(name="observacao", columnDefinition="text")
	protected String observacao;
	
	@Column(name="ativo")
	protected Boolean ativo;
	
	@Column(name="removido")
	protected Boolean removido;
	
	public BaseTO() {
		//this.ativo = true;
		this.removido = false;
	}
    
    public abstract String getAbreviation();
    
	//public Long getId() {
	//	return id;
	//}
	//public void setId(Long id) {
	//	this.id = id;
	//}
	
	public Date getDataAlteracao() {
		return dataAlteracao;
	}

	public void setDataAlteracao(Date dataAlteracao) {
		this.dataAlteracao = dataAlteracao;
	}

	public Date getDataCriacao() {
		return dataCriacao;
	}

	public void setDataCriacao(Date dataCriacao) {
		this.dataCriacao = dataCriacao;
	}
	
	public Date getDataRemocao() {
		return dataRemocao;
	}

	public void setDataRemocao(Date dataRemocao) {
		this.dataRemocao = dataRemocao;
	}

	public Boolean getRemovido() {
		return removido;
	}

	public void setRemovido(Boolean removido) {
		this.removido = removido;
	}

	public Boolean getAtivo() {
		return ativo;
	}

	public void setAtivo(Boolean ativo) {
		this.ativo = ativo;
	}

	public String getObservacao() {
		return observacao;
	}

	public void setObservacao(String observacao) {
		this.observacao = observacao;
	}	

	public Long getId() {
		return null;
	}
}
